﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq;

namespace Nexterday.Linq.Autocompiler.L2S
{
    public static class Extensions
    {
        public static IQueryable<T> AsCompilable<T>(this Table<T> query) where T : class
        {
            return AsCompilable(query, CompilationParameters.Default);
        }
        public static IQueryable<T> AsCompilable<T>(this Table<T> query,CompilationParameters parameters) where T : class
        {
            if ((IQueryable<T>)query is CompilableQuery<T>)
            {
                return (CompilableQuery<T>)(IQueryable<T>)query;
            }
            return new CompilableQuery<T>(query, parameters);
        }
    }
}
